<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>nm-online: NetworkManager Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="NetworkManager Reference Manual">
<link rel="up" href="manpages.html" title="Part I. Manual Pages">
<link rel="prev" href="nm-settings-ifcfg-rh.html" title="nm-settings-ifcfg-rh">
<link rel="next" href="nm-initrd-generator.html" title="nm-initrd-generator">
<meta name="generator" content="GTK-Doc V1.33.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts"></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="manpages.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="nm-settings-ifcfg-rh.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="nm-initrd-generator.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="nm-online"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle">nm-online</span></h2>
<p>nm-online — ask NetworkManager whether the network is connected</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="synopsis"></a><h2>Synopsis</h2>
<div class="cmdsynopsis"><p><code class="command">nm-online</code>  [<em class="replaceable"><code>OPTIONS</code></em>...]</p></div>
</div>
<div class="refsect1">
<a name="description"></a><h2>Description</h2>
<p><span class="command"><strong>nm-online</strong></span> is a utility to find out whether we are
    online. It is done by asking NetworkManager about its status. When run,
    <span class="command"><strong>nm-online</strong></span> waits until NetworkManager reports an active
    connection, or specified timeout expires. On exit, the returned status code
    should be checked (see the return codes below).</p>
<p>This tool is not very useful to call directly. It is however used by
    <code class="literal">NetworkManager-wait-online.service</code> with
    <code class="literal">--wait-for-startup</code> argument
      (see <a class="link" href="NetworkManager-wait-online.service.html" title="NetworkManager-wait-online.service"><span class="citerefentry"><span class="refentrytitle">NetworkManager-wait-online.service</span>(8)</span></a>).
    </p>
<p>By default, connections have the <code class="literal">ipv4.may-fail</code> and
    <code class="literal">ipv6.may-fail</code> properties set to <code class="literal">yes</code>;
    this means that NetworkManager waits for one of the two address families to
    complete configuration before considering the connection activated. If you
    need a specific address family configured before
    <code class="literal">network-online.target</code> is reached, set the corresponding
    <code class="literal">may-fail</code> property to <code class="literal">no</code>.</p>
</div>
<div class="refsect1">
<a name="options"></a><h2>Options</h2>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">  <code class="option">-h</code>  |   <code class="option">--help</code>  </span></p></td>
<td><p>Print help information.</p></td>
</tr>
<tr>
<td><p><span class="term">  <code class="option">-q</code>  |   <code class="option">--quiet</code>  </span></p></td>
<td><p>Don't print anything.</p></td>
</tr>
<tr>
<td><p><span class="term">  <code class="option">-s</code>  |   <code class="option">--wait-for-startup</code>  </span></p></td>
<td>
<p>Wait for NetworkManager startup to complete, rather than waiting for
          network connectivity specifically. Startup is considered complete once
          NetworkManager has activated (or attempted to activate) every auto-activate
          connection which is available given the current network state. This corresponds
          to the moment when NetworkManager logs <code class="literal">"startup complete"</code>.
          This mode is generally only useful at boot time. After startup has completed,
          <span class="command"><strong>nm-online -s</strong></span> will just return immediately, regardless of the
          current network state.</p>
<p>There are various ways to affect when startup complete is reached.
          For details see
          <a class="link" href="NetworkManager-wait-online.service.html" title="NetworkManager-wait-online.service"><span class="citerefentry"><span class="refentrytitle">NetworkManager-wait-online.service</span>(8)</span></a>.
          </p>
</td>
</tr>
<tr>
<td><p><span class="term">
            <code class="option">-t</code>  |   <code class="option">--timeout</code>  
            <em class="replaceable"><code>seconds</code></em> 
        </span></p></td>
<td><p>Time to wait for a connection, in seconds. If the option is not provided,
          the environment variable <code class="literal">NM_ONLINE_TIMEOUT</code> is honored.
          The default timeout is 30 seconds.</p></td>
</tr>
<tr>
<td><p><span class="term">  <code class="option">-x</code>  |   <code class="option">--exit</code>  </span></p></td>
<td><p>Exit immediately if NetworkManager is not running or connecting.</p></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="exit_status"></a><h2>Exit Status</h2>
<p><span class="command"><strong>nm-online</strong></span> exits with status 0 if it succeeds, a value
    greater than 0 is returned if an error occurs.</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><span class="errorcode">0</span></span></p></td>
<td><p>Success – already online or connection established within given timeout.</p></td>
</tr>
<tr>
<td><p><span class="term"><span class="errorcode">1</span></span></p></td>
<td><p>Offline or not online within given timeout.</p></td>
</tr>
<tr>
<td><p><span class="term"><span class="errorcode">2</span></span></p></td>
<td><p>Unknown or unspecified error.</p></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="see_also"></a><h2>See Also</h2>
<p><a class="link" href="nmcli.html" title="nmcli"><span class="citerefentry"><span class="refentrytitle">nmcli</span>(1)</span></a>,
    <a class="link" href="NetworkManager.html" title="NetworkManager"><span class="citerefentry"><span class="refentrytitle">NetworkManager</span>(8)</span></a>,
    <a class="link" href="NetworkManager-wait-online.service.html" title="NetworkManager-wait-online.service"><span class="citerefentry"><span class="refentrytitle">NetworkManager-wait-online.service</span>(8)</span></a>.
    </p>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.33.1</div>
</body>
</html>